<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/img/avatar/pear.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/img/avatar/pear-32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/img/avatar/pear-16x16.png">
  <link rel="mask-icon" href="/img/avatar/pear.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=FiraGo:300,300italic,400,400italic,700,700italic%7CSource+Han+Sans+SC:300,300italic,400,400italic,700,700italic%7CFira+Code:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css" integrity="sha256-mUZM63G8m73Mcidfrv5E+Y61y7a12O5mW4ezU3bxqW4=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"syvshc.gitee.io","root":"/","images":"/images","scheme":"Gemini","version":"8.7.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":true,"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"buttons","active":"gitalk","storage":true,"lazyload":true,"nav":{"gitalk":{"order":-2}},"activeClass":"gitalk"},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":5,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>
<meta name="description" content="这篇文章的需求来源为 LaTeX 问答站 的一个问题, 经观察也是普遍遇到的模板设计者的问题. 主要需要达到下图的设计效果:">
<meta property="og:type" content="article">
<meta property="og:title" content="不定长, 自动换行且有定长下划线的“论文标题”">
<meta property="og:url" content="https://syvshc.gitee.io/2021-08-04-thesis-title/index.html">
<meta property="og:site_name" content="无锤乙醇">
<meta property="og:description" content="这篇文章的需求来源为 LaTeX 问答站 的一个问题, 经观察也是普遍遇到的模板设计者的问题. 主要需要达到下图的设计效果:">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://raw.githubusercontent.com/syvshc/image/master/postimg/thesis-title/goal.png">
<meta property="og:image" content="https://raw.githubusercontent.com/syvshc/image/master/postimg/thesis-title/CJKunderline.png">
<meta property="og:image" content="https://raw.githubusercontent.com/syvshc/image/master/postimg/thesis-title/adjustbox.jpg">
<meta property="og:image" content="https://raw.githubusercontent.com/syvshc/image/master/postimg/thesis-title/muzimuzhi.jpg">
<meta property="article:published_time" content="2021-08-04T05:11:50.000Z">
<meta property="article:modified_time" content="2021-11-19T04:47:46.670Z">
<meta property="article:author" content="Zhonghao Sun">
<meta property="article:tag" content="LaTeX">
<meta property="article:tag" content="排版设计">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://raw.githubusercontent.com/syvshc/image/master/postimg/thesis-title/goal.png">


<link rel="canonical" href="https://syvshc.gitee.io/2021-08-04-thesis-title/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://syvshc.gitee.io/2021-08-04-thesis-title/","path":"2021-08-04-thesis-title/","title":"不定长, 自动换行且有定长下划线的“论文标题”"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>不定长, 自动换行且有定长下划线的“论文标题” | 无锤乙醇</title>
  
  <script class="next-config" data-name="google_analytics" type="application/json">{"tracking_id":"UA-127047099-2","only_pageview":true}</script>
  <script src="/js/third-party/analytics/google-analytics.js"></script>




  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">无锤乙醇</h1>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">学而未精</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li>
        <li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li>
        <li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%AE%BE%E8%AE%A1%E9%9A%BE%E7%82%B9"><span class="nav-number">1.</span> <span class="nav-text">设计难点</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%B0%9D%E8%AF%95%E5%AE%9E%E7%8E%B0"><span class="nav-number">2.</span> <span class="nav-text">尝试实现</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E6%A0%BC%E7%BA%BF%E4%BD%9C%E4%B8%BA%E4%B8%8B%E5%88%92%E7%BA%BF"><span class="nav-number">2.1.</span> <span class="nav-text">格线作为下划线</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#cjkunderline-%E8%87%AA%E5%8A%A8%E5%A4%84%E7%90%86"><span class="nav-number">2.2.</span> <span class="nav-text">\CJKunderline 自动处理</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%9C%80%E7%A6%BB%E8%B0%B1%E7%9A%84%E5%88%86%E5%89%B2%E5%AD%97%E7%AC%A6%E4%B8%B2"><span class="nav-number">3.</span> <span class="nav-text">最离谱的分割字符串</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%8F%AF%E5%AE%9E%E7%8E%B0%E7%9A%84%E6%96%B9%E6%B3%95"><span class="nav-number">4.</span> <span class="nav-text">可实现的方法</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#adjustbox-%E5%AE%8F%E5%8C%85"><span class="nav-number">4.1.</span> <span class="nav-text">adjustbox 宏包</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#rule-%E4%B8%8E%E6%96%87%E5%AD%97%E5%88%86%E5%88%AB%E6%8E%92%E7%89%88"><span class="nav-number">4.2.</span> <span class="nav-text">\rule 与文字分别排版</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BB%BB%E5%8A%A1%E5%AE%8C%E6%88%90"><span class="nav-number">5.</span> <span class="nav-text">任务完成</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-overview">
            <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Zhonghao Sun"
      src="/img/avatar/qqavatar.jpg">
  <p class="site-author-name" itemprop="name">Zhonghao Sun</p>
  <div class="site-description" itemprop="description">从未想过背叛, 也不必说忠贞</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">17</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">12</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">18</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/syvshc" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;syvshc" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:syvshc@foxmail.com" title="E-Mail → mailto:syvshc@foxmail.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://tex.stackexchange.com/users/180617/syvshc" title="TeX.SE → https:&#x2F;&#x2F;tex.stackexchange.com&#x2F;users&#x2F;180617&#x2F;syvshc" rel="noopener" target="_blank"><i class="fab fa-stack-exchange fa-fw"></i>TeX.SE</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://studio.youtube.com/channel/UCqvoLd2tlB_xuRkZ7_GYOVw/editing/details" title="YouTube → https:&#x2F;&#x2F;studio.youtube.com&#x2F;channel&#x2F;UCqvoLd2tlB_xuRkZ7_GYOVw&#x2F;editing&#x2F;details" rel="noopener" target="_blank"><i class="fab fa-youtube fa-fw"></i>YouTube</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://www.worldcubeassociation.org/persons/2015SUNZ03/" title="WCA → https:&#x2F;&#x2F;www.worldcubeassociation.org&#x2F;persons&#x2F;2015SUNZ03&#x2F;" rel="noopener" target="_blank"><i class="fas fa-cubes fa-fw"></i>WCA</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://steamcommunity.com/id/syvshc" title="Steam → https:&#x2F;&#x2F;steamcommunity.com&#x2F;id&#x2F;syvshc" rel="noopener" target="_blank"><i class="fab fa-steam fa-fw"></i>Steam</a>
      </span>
  </div>
  <div class="cc-license site-overview-item animated" itemprop="license">
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" class="cc-opacity" rel="noopener" target="_blank"><img src="https://cdn.jsdelivr.net/npm/@creativecommons/vocabulary@2020.11.3/assets/license_badges/small/by_nc_sa.svg" alt="Creative Commons"></a>
  </div>


  <div class="links-of-blogroll site-overview-item animated">
    <div class="links-of-blogroll-title"><i class="fas fa-link fa-fw"></i>
      友情链接
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="https://www.latexstudio.net/" title="https:&#x2F;&#x2F;www.latexstudio.net" rel="noopener" target="_blank">LaTeX 工作室</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://sikouhjw.github.io/" title="https:&#x2F;&#x2F;sikouhjw.github.io&#x2F;" rel="noopener" target="_blank">sikouhjw</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://zhuanlan.zhihu.com/typography-and-latex/" title="https:&#x2F;&#x2F;zhuanlan.zhihu.com&#x2F;typography-and-latex&#x2F;" rel="noopener" target="_blank">muzimuzhi</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://liam.page/" title="https:&#x2F;&#x2F;liam.page&#x2F;" rel="noopener" target="_blank">Liam</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://stone-zeng.github.io/" title="https:&#x2F;&#x2F;stone-zeng.github.io&#x2F;" rel="noopener" target="_blank">stone-zeng</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://muyuuuu.github.io/" title="https:&#x2F;&#x2F;muyuuuu.github.io&#x2F;" rel="noopener" target="_blank">兰铃</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="http://yuxtech.club/" title="http:&#x2F;&#x2F;yuxtech.club&#x2F;" rel="noopener" target="_blank">yuxtech</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://camusecao.top/" title="https:&#x2F;&#x2F;camusecao.top&#x2F;" rel="noopener" target="_blank">CamuseCao</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://www.alanshawn.com/" title="https:&#x2F;&#x2F;www.alanshawn.com&#x2F;" rel="noopener" target="_blank">Alan Xiang</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://ssayno.github.io/" title="https:&#x2F;&#x2F;ssayno.github.io&#x2F;" rel="noopener" target="_blank">ssayno</a>
        </li>
    </ul>
  </div>

          </div>
        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

  <a href="https://github.com/syvshc" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://syvshc.gitee.io/2021-08-04-thesis-title/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/img/avatar/qqavatar.jpg">
      <meta itemprop="name" content="Zhonghao Sun">
      <meta itemprop="description" content="从未想过背叛, 也不必说忠贞">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="无锤乙醇">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          不定长, 自动换行且有定长下划线的“论文标题”
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-08-04 13:11:50" itemprop="dateCreated datePublished" datetime="2021-08-04T13:11:50+08:00">2021-08-04</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-11-19 12:47:46" itemprop="dateModified" datetime="2021-11-19T12:47:46+08:00">2021-11-19</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/LaTeX/" itemprop="url" rel="index"><span itemprop="name">LaTeX</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/LaTeX/%E6%A8%A1%E6%9D%BF/" itemprop="url" rel="index"><span itemprop="name">模板</span></a>
        </span>
    </span>

  
    <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span id="busuanzi_value_page_pv"></span>
    </span>
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>8.7k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>8 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <p>这篇文章的需求来源为 <a target="_blank" rel="noopener" href="https://ask.latexstudio.net/ask/question/3650.html">LaTeX 问答站</a> 的一个问题, 经观察也是普遍遇到的模板设计者的问题. 主要需要达到下图的设计效果:</p>
<p><img src="https://raw.githubusercontent.com/syvshc/image/master/postimg/thesis-title/goal.png" /></p>
<span id="more"></span>
<h3 id="设计难点">设计难点</h3>
<p>可以看到设计难点有</p>
<ol type="1">
<li>标题长度不固定, 可能需要自动换行</li>
<li>需要将定长的下划线全范围覆盖</li>
<li>(可选) 需要照顾到用户对自动换行点不满意, 而进行的手动换行</li>
<li>(可选) 由于单行标题与多行标题的视觉效果不同, 也避免第二行只有少量文字而造成的“不好的”观感进行额外的调整</li>
</ol>
<h3 id="尝试实现">尝试实现</h3>
<p>这个问题要使用的基础工具肯定是<strong>表格</strong>, 因为除了标题还会有其他的文字同时需要对齐</p>
<h4 id="格线作为下划线">格线作为下划线</h4>
<p>我在探究的过程中首先想使用定宽表格 + 下格线来实现这一点很快我就否定了这个想法, 因为</p>
<ol type="1">
<li>定宽表格内部的换行无法添加下格线作为“下划线”</li>
<li>(次要) 定宽表格只能机械地自动换行, 无法手动换行</li>
</ol>
<h4 id="cjkunderline-自动处理"><code>\CJKunderline</code> 自动处理</h4>
<p>否定了这个想法之后继续探究, 我想到了可以使用 <code>\CJKunderline</code> 命令<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a>, 因为该下划线可以自动处理中文的换行, 把它应用在 <code>\parbox</code> 中进行一个嵌套应该可以</p>
<figure class="highlight tex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">\documentclass&#123;ctexart&#125;</span><br><span class="line">\usepackage&#123;xeCJKfntef&#125;</span><br><span class="line">\begin&#123;document&#125;</span><br><span class="line">    \parbox&#123;13\ccwd&#125;&#123;\centering\CJKunderline&#123;这是一个很长的学位论文题目中华人民共和国刑法这是一个很长的学位论文&#125;&#125;</span><br><span class="line">\end&#123;document&#125;</span><br></pre></td></tr></table></figure>
<p><img src="https://raw.githubusercontent.com/syvshc/image/master/postimg/thesis-title/CJKunderline.png" /></p>
<p>问题又出现了, 它无法将最后一行的下划线进行填充. 虽然可以在文本的末尾添加 <code>\hfill</code> 来延长下划线, 但是不居中了.</p>
<h3 id="最离谱的分割字符串">最离谱的分割字符串</h3>
<p>接下来我想通过分割标题字符串, 然后对每一行的字符串单独使用下划线, 毕竟对于确定的字符串的操作就随意了, 然后再将它们套入 <code>\parbox</code> 就 ok 了, 然后我找到了 <a target="_blank" rel="noopener" href="https://ctan.org/pkg/xstring"><code>xstring</code></a> 宏包来对标题进行长度记数与分隔, 然后我将这个想法在 <a target="_blank" rel="noopener" href="https://tex.stackexchange.com/questions/609378/cut-string-into-pieces">TeX.SE</a> 进行了提问, 下面简单叙述一下</p>
<ol type="1">
<li>使用 <code>\StrLen</code> 命令来确定标题的长度 <code>n</code></li>
<li>每行假定可放置 13 个字符, 那么就通过 <a target="_blank" rel="noopener" href="https://ctan.org/pkg/xfp"><code>xfp</code></a> 提供的计算命令 <code>\fpeval</code> 计算标题被分隔的块数 <code>p = n/13</code></li>
<li>然后通过 <a target="_blank" rel="noopener" href="https://www.ctan.org/pkg/pgf"><code>tikz-pgf</code></a> 宏集提供的 <code>\foreach</code>命令来对块数 <code>p</code> 进行循环, 从而使每一行都具有定长的下划线而且居中</li>
</ol>
<p>但是在 <code>\fpeval</code> 计算的步骤就直接寄了, 会报 <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">! You can&#39;t use &#96;\let&#39; after \the.</span><br><span class="line">&lt;argument&gt; \let</span><br><span class="line"></span><br><span class="line">l.5     \fpeval&#123;\StrLen&#123;\abc&#125;&#x2F;5&#125;</span><br><span class="line"></span><br><span class="line">?</span><br></pre></td></tr></table></figure></p>
<h3 id="可实现的方法">可实现的方法</h3>
<h4 id="adjustbox-宏包"><code>adjustbox</code> 宏包</h4>
<p>然后 QQ 群LaTeX技术交流 1 群 (91940767) 中的行者 (qq:957114619) 根据上述问题的 <a target="_blank" rel="noopener" href="https://tex.stackexchange.com/a/609433/180617">回答</a> 进行了整理, 发布到了 <a target="_blank" rel="noopener" href="https://latexstudio.net/index/details/index/mid/1799.html">LaTeXStudio</a>. 这里进行一下备份</p>
<figure class="highlight tex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br></pre></td><td class="code"><pre><span class="line">% 本文来源:https:&#x2F;&#x2F;tex.stackexchange.com&#x2F;questions&#x2F;609378&#x2F;cut-string-into-pieces,LaTeX技术交流 2 群(qq群号：478023327) 的“乙醇”网友（qq号：914920345）提供来源</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">\documentclass[12pt]&#123;article&#125;</span><br><span class="line">\usepackage&#123;ctex&#125;</span><br><span class="line">\usepackage&#123;geometry&#125;</span><br><span class="line">\geometry&#123;a4paper,height&#x3D;225mm,width&#x3D;156mm&#125;</span><br><span class="line"></span><br><span class="line">\usepackage&#123;adjustbox&#125;</span><br><span class="line"></span><br><span class="line">%\usepackage&#123;lipsum&#125;</span><br><span class="line">\usepackage&#123;xurl&#125;</span><br><span class="line">\usepackage&#123;hyperref&#125;</span><br><span class="line">\begin&#123;document&#125;</span><br><span class="line">\title&#123;“固定列宽、内容居中、自动换行、且有下画线”效果的一种实现方法&#125;</span><br><span class="line">\author&#123;zhangsming@foxmail.com&#125;</span><br><span class="line">\date&#123;2021&#x2F;08&#x2F;04&#125;</span><br><span class="line">\maketitle</span><br><span class="line"></span><br><span class="line">本文是 \LaTeX 工作室网站问答栏目“如何实现“固定列宽，自动换行且有下框线”问题（\url&#123;https:&#x2F;&#x2F;ask.latexstudio.net&#x2F;ask&#x2F;question&#x2F;3486.html&#125;）的一种实现方法。</span><br><span class="line"></span><br><span class="line">%\usepackage&#123;adjustbox&#125;</span><br><span class="line">\newlength\myheight</span><br><span class="line">\newcommand\Mysavedprevdepth&#123;&#125;%</span><br><span class="line">\newcommand\UnderlineCentered[3]&#123;%</span><br><span class="line">  \begin&#123;adjustbox&#125;&#123;minipage&#x3D;[t]&#123;\dimexpr#1\relax&#125;,gstore totalheight&#x3D;\myheight,margin&#x3D;0pt&#125;%</span><br><span class="line">    \centering\leavevmode#3\par\xdef\Mysavedprevdepth&#123;\the\prevdepth&#125;%</span><br><span class="line">  \end&#123;adjustbox&#125;%</span><br><span class="line">  \hspace*&#123;-\dimexpr#1\relax&#125;%</span><br><span class="line">  \begin&#123;adjustbox&#125;&#123;minipage&#x3D;[t][\myheight]&#123;\dimexpr#1\relax&#125;,margin&#x3D;0pt&#125;%</span><br><span class="line">    \vphantom&#123;Eg&#125;\lower\dimexpr#2\relax\hbox to\hsize&#123;\leaders\hrule\hfill\kern0pt&#125;\par</span><br><span class="line">    \kern-\dimexpr#2\relax</span><br><span class="line">    \xleaders\vbox to\baselineskip &#123;\vfill\hbox&#123;\lower\dimexpr#2\relax\hbox to\hsize&#123;\leaders\hrule\hfill\kern0pt&#125;&#125;\kern-\dimexpr#2\relax&#125;\vfill</span><br><span class="line">    \kern\Mysavedprevdepth</span><br><span class="line">  \end&#123;adjustbox&#125;%</span><br><span class="line">&#125;%</span><br><span class="line"></span><br><span class="line">本文的主体代码来源于 StackExchange 网站“Cut string into pieces”问题（\url&#123;https:&#x2F;&#x2F;tex.stackexchange.com&#x2F;questions&#x2F;609378&#x2F;cut-string-into-pieces&#125;）名为“Ulrich Diez”用户的回答。</span><br><span class="line"></span><br><span class="line">\bigskip</span><br><span class="line"></span><br><span class="line">\begin&#123;center&#125;</span><br><span class="line">  \begin&#123;tabular&#125;&#123;rc&#125;</span><br><span class="line">    论文题目： &amp; \UnderlineCentered&#123;8cm&#125;&#123;1.5mm&#125;&#123;这是一个很长很长很长很长很长很长很长很长\\很长很长很长很长很长很长很长很长的标题&#125;\\</span><br><span class="line">  \end&#123;tabular&#125;</span><br><span class="line">\end&#123;center&#125;</span><br><span class="line"></span><br><span class="line">\bigskip</span><br><span class="line"></span><br><span class="line">上列排版效果的代码使用了自定义的 UnderlineCentered 宏：</span><br><span class="line"></span><br><span class="line">\bigskip</span><br><span class="line"></span><br><span class="line">\verb|\UnderlineCentered&#123;&lt;文本宽度&gt;&#125;&#123;&lt;下画线深度&gt;&#125;&#123;&lt;文本内容&gt;&#125;|</span><br><span class="line"></span><br><span class="line">\bigskip</span><br><span class="line"></span><br><span class="line">其中，\verb|&lt;文本宽度&gt;| 和 \verb|&lt;下画线深度&gt;| 的取值均为长度。上例中的代码是：</span><br><span class="line"></span><br><span class="line">\bigskip</span><br><span class="line"></span><br><span class="line">\verb|\UnderlineCentered&#123;8cm&#125;&#123;1.5mm&#125;&#123;这是一个很长...&#125;|</span><br><span class="line"></span><br><span class="line">\bigskip</span><br><span class="line"></span><br><span class="line">\verb|\UnderlineCentered| 主要使用 \verb|adjustbox| 宏包提供的 \verb|adjustbox| 定义，具体实现方式请查看本文源代码。</span><br><span class="line"></span><br><span class="line">\bigskip</span><br><span class="line"></span><br><span class="line">致谢：感谢 LaTeX技术交流 2 群(qq群号：478023327) 的“哈尔滨 - 乙醇”网友（qq号：914920345）提供代码来源。</span><br><span class="line"></span><br><span class="line">\end&#123;document&#125;</span><br></pre></td></tr></table></figure>
<p>截取部分实现效果为 <img src="https://raw.githubusercontent.com/syvshc/image/master/postimg/thesis-title/adjustbox.jpg" /></p>
<p>可见, 该方法支持自动换行及手动换行, 满足了需求 1, 2, 3, 但是再进行观察可以发现第 4 行只有一个“题”字, 美观度不足, 但是瑕不掩瑜, 任务完成.</p>
<h4 id="rule-与文字分别排版"><code>\rule</code> 与文字分别排版</h4>
<p>该方法来自于我的另一个 <a target="_blank" rel="noopener" href="https://github.com/CTeX-org/forum/issues/208">Github</a> 上问题, 其中 <a target="_blank" rel="noopener" href="https://github.com/muzimuzhi">慕子</a> 回答</p>
<blockquote>
<p>知乎文章《<a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/51494365">双语标题：LaTeX 实现</a>》 里有一个实现</p>
</blockquote>
<p>这个文章也是他写的, 可以完美实现我们的需求, 除了代码有点长（</p>
<figure class="highlight tex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br></pre></td><td class="code"><pre><span class="line">\documentclass&#123;ctexart&#125;</span><br><span class="line">\usepackage&#123;calc&#125;</span><br><span class="line">\makeatletter</span><br><span class="line">\renewcommand&#123;\arraystretch&#125;&#123;1.2&#125;</span><br><span class="line"></span><br><span class="line">% inner temp length</span><br><span class="line">\newlength\@tempTitleHt</span><br><span class="line">\newlength\@tempTitleMaxWd</span><br><span class="line"></span><br><span class="line">% length used as parameters， &quot;Wd&quot; is a shorthand for &quot;Width&quot;</span><br><span class="line">\newlength\titleSingleLineMaxWd</span><br><span class="line">\newlength\titleMultiLineMaxWd</span><br><span class="line">\newlength\titleLRExtraWd</span><br><span class="line">\newlength\titleSepWd</span><br><span class="line"></span><br><span class="line">\setlength\titleSingleLineMaxWd&#123;0.6\textwidth&#125;</span><br><span class="line">\setlength\titleMultiLineMaxWd&#123;0.5\textwidth&#125;</span><br><span class="line">\setlength\titleLRExtraWd&#123;.5em&#125;</span><br><span class="line">\setlength\titleSepWd&#123;.5em&#125;</span><br><span class="line"></span><br><span class="line">% main macro, using a simple table</span><br><span class="line">% \newcommand&#123;\multilingualTitles&#125;[2]&#123;%</span><br><span class="line">%   \par</span><br><span class="line">%   &#123;\noindent\centering</span><br><span class="line">%   \begin&#123;tabular&#125;&#123;r @&#123;\hspace&#123;\titleSepWd&#125;&#125; p&#123;\titleSingleLineMaxWd&#125;&#125;</span><br><span class="line">%   	中文标题           &amp; \titleBox&#123;#1&#125; \\</span><br><span class="line">%   	                 &amp;               \\[-10pt]</span><br><span class="line">%   	Title in English &amp; \titleBox&#123;#2&#125;</span><br><span class="line">%   \end&#123;tabular&#125;\par&#125;%</span><br><span class="line">% &#125;</span><br><span class="line"></span><br><span class="line">% draw a fixed-width underline</span><br><span class="line">\newcommand&#123;\titleUnderline&#125;&#123;%</span><br><span class="line">  \rule[-.3em]&#123;\titleSingleLineMaxWd + 2\titleLRExtraWd&#125;&#123;.5pt&#125;&#125;</span><br><span class="line"></span><br><span class="line">% title content typesetter</span><br><span class="line">\newcommand\titleBox[1]&#123;%</span><br><span class="line">  \setlength\@tempTitleMaxWd\titleSingleLineMaxWd</span><br><span class="line">  % Measure the total height of #1 subject to \titleSingleLineMaxWd.</span><br><span class="line">  % Here \@titleBox is necessary when #1 contains &quot;\\&quot;.</span><br><span class="line">  \settototalheight\@tempTitleHt&#123;\@titleBox&#123;#1&#125;&#125;%</span><br><span class="line">  \ifdim\@tempTitleHt&#x3D;0pt%</span><br><span class="line">    % case 1: #1 causes empty output</span><br><span class="line">    \titleUnderline</span><br><span class="line">  \else</span><br><span class="line">    % Change to LR mode, for inserting a zero-width box right after.</span><br><span class="line">    \leavevmode</span><br><span class="line">    % note: Use \normalbaseineskip instead of \baselineskip, </span><br><span class="line">    %       since the latter is set to 0pt inside tabular env.</span><br><span class="line">    \ifdim\@tempTitleHt&gt;\normalbaselineskip</span><br><span class="line">      % case 2: #1 is fit for multilines, or contains &#96;\\&#96;, hence</span><br><span class="line">      %         \titleMultiLineMaxWd is used instead, and the total </span><br><span class="line">      %         height of #1 subject to new max width is re-measured.</span><br><span class="line">      \setlength\@tempTitleMaxWd\titleMultiLineMaxWd</span><br><span class="line">      \settototalheight\@tempTitleHt&#123;\@titleBox&#123;#1&#125;&#125;%</span><br><span class="line">      % \rlap&#123;\smash&#123;...&#125;&#125; typesets content of its argument normally </span><br><span class="line">      % but sets it into a zero sized box. Here \@titleBox set </span><br><span class="line">      % (possiblly) multi-line text into a single box, since \smash </span><br><span class="line">      % only takes in argument spreading one line.</span><br><span class="line">      %</span><br><span class="line">      % Every line of title content needs an underline, hense we do</span><br><span class="line">      % a loop to typeset one underline for every line the title </span><br><span class="line">      % content actually spreads.</span><br><span class="line">      \rlap&#123;\smash&#123;\@titleBox&#123;%</span><br><span class="line">        \@whiledim\@tempTitleHt&gt;0pt%</span><br><span class="line">        \leavevmode</span><br><span class="line">        % </span><br><span class="line">        \do&#123;%</span><br><span class="line">          \rlap&#123;\titleUnderline&#125;\\%</span><br><span class="line">          \addtolength\@tempTitleHt&#123;-\normalbaselineskip&#125;%</span><br><span class="line">        &#125;%</span><br><span class="line">      &#125;&#125;&#125;%</span><br><span class="line">      % Insert h-offset to manually center the title content.</span><br><span class="line">      \hspace&#123;\dimexpr\titleLRExtraWd + .5\titleSingleLineMaxWd - .5\titleMultiLineMaxWd\relax&#125;%</span><br><span class="line">      \@titleBox&#123;\centering #1&#125;%</span><br><span class="line">    \else</span><br><span class="line">      % case 3: #1 is fit for one line</span><br><span class="line">      \rlap&#123;\titleUnderline&#125;%</span><br><span class="line">      \hspace&#123;\titleLRExtraWd&#125;%</span><br><span class="line">      \@titleBox&#123;\centering #1&#125;%</span><br><span class="line">    \fi</span><br><span class="line">  \fi</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">% common operations on every title content</span><br><span class="line">\newcommand&#123;\@titleBox&#125;[1]&#123;%</span><br><span class="line">  \parbox[t]&#123;\@tempTitleMaxWd&#125;&#123;#1&#125;&#125;</span><br><span class="line">\makeatother</span><br><span class="line">\newlength&#123;\lwtm&#125;</span><br><span class="line">\setlength&#123;\lwtm&#125;&#123;\widthof&#123;论文题目 :&#125;&#125;</span><br><span class="line">\begin&#123;document&#125;</span><br><span class="line">\begin&#123;tabular&#125;&#123;p&#123;\lwtm&#125; p&#123;\titleSingleLineMaxWd&#125;&#125;</span><br><span class="line">    \makebox[\lwtm][s]&#123;论文题目 :&#125;           &amp; \titleBox&#123;这是一个很长的学位论文题目中华人民共和国刑法这是一个&#125; \\</span><br><span class="line">    \makebox[\lwtm][s]&#123;论文题目 :&#125;           &amp; \titleBox&#123;这是一个很长的学位论文题目中华人民共和&#125; \\</span><br><span class="line">    \makebox[\lwtm][s]&#123;论文题目 :&#125;           &amp; \titleBox&#123;这是一个很长的学位论文题目中华人民共和国&#125; \\</span><br><span class="line">    \makebox[\lwtm][s]&#123;论文题目 :&#125;           &amp; \titleBox&#123;这是一个很长的学位论文题目\\中华人民共和国刑法这是一个&#125; \\</span><br><span class="line">                                            &amp;               \\[-10pt] % 用于分隔题目与其他信息</span><br><span class="line">    \makebox[\lwtm][s]&#123;培养单位 :&#125;           &amp;    \titleBox&#123;厚大法考&#125;          \\</span><br><span class="line">    \makebox[\lwtm][s]&#123;专业 :&#125;               &amp;   \titleBox&#123;法学&#125;\\</span><br><span class="line">    \makebox[\lwtm][s]&#123;导师 :&#125;               &amp;   \titleBox&#123;罗翔&#125; \\</span><br><span class="line">    \makebox[\lwtm][s]&#123;研究生 :&#125;              &amp;  \titleBox&#123;张三&#125; \\</span><br><span class="line">    \makebox[\lwtm][s]&#123;完成时间 :&#125;            &amp;  \titleBox&#123;2003.8&#125; \\</span><br><span class="line">\end&#123;tabular&#125;</span><br><span class="line">\end&#123;document&#125;</span><br></pre></td></tr></table></figure>
<p>该代码中含有大量的注释, 使我能在很短的时间内 (指一上午) 读完代码并且了解操作原理, 下面是实现效果 <img src="https://raw.githubusercontent.com/syvshc/image/master/postimg/thesis-title/muzimuzhi.jpg" /></p>
<p>可以看到, 第二个“论文题目”中单行中的文字比多第三个中的多行文字只少了一个“国”字但是它可以自动换行并且制造一个良好的视觉效果, 代码的关键在于</p>
<figure class="highlight tex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">% 设定不同的单行与多行的最大行长度</span><br><span class="line">\newlength\titleSingleLineMaxWd</span><br><span class="line">\newlength\titleMultiLineMaxWd</span><br><span class="line">...</span><br><span class="line">\setlength\titleSingleLineMaxWd&#123;0.6\textwidth&#125;</span><br><span class="line">\setlength\titleMultiLineMaxWd&#123;0.5\textwidth&#125;</span><br><span class="line">...</span><br><span class="line">% 将文本内容放入单行长度相当的 \parbox 中, </span><br><span class="line">% 判断其能否用单行进行排版, </span><br><span class="line">% 如果不能, 将使用多行的最大行长相当的 \parbox 进行排版, </span><br><span class="line">% 这样就不会出现第二行之后 1 个或 2 个字的情况</span><br><span class="line">\newcommand&#123;\@titleBox&#125;[1]&#123;%</span><br><span class="line">  \parbox[t]&#123;\@tempTitleMaxWd&#125;&#123;#1&#125;&#125;</span><br></pre></td></tr></table></figure>
<h3 id="任务完成">任务完成</h3>
<p>先放松一下, 有更好的方法可以评论, 我会进行补充.</p>
<section class="footnotes" role="doc-endnotes">
<hr />
<ol>
<li id="fn1" role="doc-endnote"><p>该命令由宏集 <a target="_blank" rel="noopener" href="https://ctan.org/pkg/xecjk"><code>xeCJK</code></a> 中宏包 <code>xeCJKfnt</code> 提供<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="reward-container">
  <div></div>
  <button>
    赞赏
  </button>
  <div class="post-reward">
      <div>
        <img src="/img/avatar/wechatpay.png" alt="Zhonghao Sun 微信">
        <span>微信</span>
      </div>
      <div>
        <img src="/img/avatar/alipay.jpg" alt="Zhonghao Sun 支付宝">
        <span>支付宝</span>
      </div>

  </div>
</div>

          

<div class="post-copyright">
<ul>
  <li class="post-copyright-author">
      <strong>本文作者： </strong>Zhonghao Sun
  </li>
  <li class="post-copyright-link">
      <strong>本文链接：</strong>
      <a href="https://syvshc.gitee.io/2021-08-04-thesis-title/" title="不定长, 自动换行且有定长下划线的“论文标题”">https://syvshc.gitee.io/2021-08-04-thesis-title/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>

          <div class="post-tags">
              <a href="/tags/LaTeX/" rel="tag"># LaTeX</a>
              <a href="/tags/%E6%8E%92%E7%89%88%E8%AE%BE%E8%AE%A1/" rel="tag"># 排版设计</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2021-04-07-illegal-temp-cause-tlinstall-failure/" rel="prev" title="Windows 不合法的缓存路径导致 TeX Live 安装失败">
                  <i class="fa fa-chevron-left"></i> Windows 不合法的缓存路径导致 TeX Live 安装失败
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2021-08-04-cumcmthesis-maketitle/" rel="next" title="全国大学生数学建模竞赛模板的 `\maketitle` 处报错">
                  全国大学生数学建模竞赛模板的 `\maketitle` 处报错 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    <div class="comments gitalk-container"></div>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Syvshc</span>
</div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
    <span title="站点总字数">68k</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">1:02</span>
  </span>
</div>
<div class="busuanzi-count">
    <span class="post-meta-item" id="busuanzi_container_site_uv">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-item" id="busuanzi_container_site_pv">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script>

  
<script src="/js/third-party/search/local-search.js"></script>




  
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>




  

  <script class="next-config" data-name="enableMath" type="application/json">false</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"ams","js":{"url":"https://cdn.jsdelivr.net/npm/mathjax@3.2.0/es5/tex-mml-chtml.js","integrity":"sha256-r+3itOMtGGjap0x+10hu6jW/gZCzxHsoKrOd7gyRSGY="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1.7.2/dist/gitalk.css" integrity="sha256-AJnUHL7dBv6PGaeyPQJcgQPDjt/Hn/PvYZde1iqfp8U=" crossorigin="anonymous">

<script class="next-config" data-name="gitalk" type="application/json">{"enable":true,"github_id":"syvshc","repo":"syvshc.github.io","client_id":"da0debc4d456cb5f3371","client_secret":"14ec65d19a969abe01994143eff233a4180484aa","admin_user":"syvshc","distraction_free_mode":true,"proxy":"https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token","language":"zh-CN","js":{"url":"https://cdn.jsdelivr.net/npm/gitalk@1.7.2/dist/gitalk.min.js","integrity":"sha256-Pmj85ojLaPOWwRtlMJwmezB/Qg8BzvJp5eTzvXaYAfA="},"path_md5":"181b00da60b6ce03e577820e20d32527"}</script>
<script src="/js/third-party/comments/gitalk.js"></script>

</body>
</html>
